<%-- 
    Document   : formGoganpa
    Created on : 26-feb-2014, 10:57:43
    Author     : Juan
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="utils.OS"%>
<%@page import="java.util.List"%>
<%@page import="java.io.File"%>
<%@page import="archivos.Txt"%>
<!DOCTYPE html>
<html lang="en">
    <head>
        <%@include file="../disenoWeb/title.html" %>
        <meta charset="utf-8">
        <%@include file="../disenoWeb/head.html" %>
        <script src="../disenoWeb/js/formulario.js" type="text/javascript"></script>

    </head>
    <body id="page2" onload="javascript:cambiarVisualizacionFormularioKegg();">
        <div class="extra">
            <!--==============================header=================================-->
            <header>
                <%@include file="../disenoWeb/divHeader.jsp" %>
                <div class="menu-row">
                    <div class="menu-bg">
                        <div class="main">
                            <nav class="indent-left">
                                <ul class="menu wrapper">
                                    <%@include file="menuGoganpa.html" %>
                                </ul>
                            </nav>
                        </div>
                    </div>
                </div>
                <div class="row-bot">
                    <div class="center-shadow">
                    </div>
                </div>
            </header>

            <!--==============================content================================-->
            <section id="content">
                <div class="content-bg">
                    <div class="main">
                        <%                            /*Se lee el fichero orgGO.txt para obtener la lista de todos los organismos*/
                            String separator = OS.getDirectorySeparator();
                            String ubicacionGO = application.getRealPath(separator + "WEB-INF" + separator + "datos");
                            String nombreORGGoganpa = "orgGO.txt";
                            File archivoGO = new File(ubicacionGO + separator + nombreORGGoganpa);
                            List<String> listaGO = Txt.listaOrgGO(archivoGO);

                            /*Se recoge el organismo seleccionado para que cuando sea distinto de null
                             deje de mostrar la lista de organismos y muestre la carga de ficheros*/
                            String submit_organismo = request.getParameter("submit_organismo_goganpa");
                            if (submit_organismo == null) {
                        %>


                        <form id="form_select_orgs_goganpa">
                            <h4>Organism:</h4>
                            <select name="orgs_goganpa" required="required">

                                <%             for (int i = 1; i < listaGO.size(); i += 2) {

                                %>
                                <option value=<%=listaGO.get(i - 1)%>><%=listaGO.get(i)%></option>
                                <%}
                                %>
                            </select> 

                            <h4>Ontology:</h4>

                            <select name="ont" required="required">

                                <option value="BP">Biological Proccess</option>
                                <option value="CC">Cellular Component</option>
                                <option value="MF">Molecular Function</option>


                            </select>

                            <h4>Measure:</h4>
                            <select name="medidas_goganpa" required="required">

                                <option value="Resnik">Resnik</option>
                                <option value="Lin">Lin</option>
                                <option value="Rel">Rel</option>
                                <option value="Jiang">Jiang</option>
                                <option value="Wang">Wang</option>
                            </select>

                            <h4>Combine:</h4>
                            <select name="combine_goganpa" required="required">

                                <option value="max">MAX</option>
                                <option value="average">Average</option>
                                <option value="rcmax">Rcmax</option>
                                <option value="bma">BMA</option>

                            </select>

                            <h4>Umbral:</h4>
                            <select name="umbral" required="required">

                                <option value="0.1">0.1</option>
                                <option value="0.2">0.2</option>
                                <option value="0.3">0.3</option>
                                <option value="0.4">0.4</option>
                                <option value="0.5">0.5</option>
                                <option value="0.6">0.6</option>
                                <option value="0.7">0.7</option>
                                <option value="0.8">0.8</option>
                                <option value="0.9">0.9</option>

                            </select>

                            <br />
                            <button type="submit" name="submit_organismo_goganpa" value=" Aceptar ">Aceptar</button>
                        </form>

                        <%                        } else {
                            /*Se colocan todas las variables en session para luego utilizarlo en operaciones posteriores*/
                            String orgGO = request.getParameter("orgs_goganpa");
                            session.setAttribute("orgGO", orgGO);

                            String ontology = request.getParameter("ont");
                            session.setAttribute("ontology", ontology);

                            String medida = request.getParameter("medidas_goganpa");
                            session.setAttribute("medida", medida);

                            String combine = request.getParameter("combine_goganpa");
                            session.setAttribute("combine", combine);

                            String nivelGO = request.getParameter("umbral");
                            session.setAttribute("nivelGO", nivelGO);

                        %>


                        <div id="form-goganpa">
                            <h3>Genes List <img width="25px" height="25px" src="../disenoWeb/images/information.png" alt="Information" onclick="javascript:informacionKegg();" /></h3>
                            <div id="informationKegg" style="display: none">A list of altered Genes (a gene for each line).<br/>
                                The correct gene's nomenclature must be "ensembl".</div>
                            <form action="goganpa.jsp" method="post" id="form_archivos" enctype="multipart/form-data">

                                <input type="file" name="file1_goganpa" accept=".txt" required="required" />
                                <p><button type="submit" id="button-goganpa" value="Enviar" onclick="muestraLoadingGoganpa();">Accept</button></p>
                            </form>

                        </div>
                        <div id="imagen-loader-goganpa" class="loader" style="display: none">
                            <img src="../disenoWeb/images/loader.gif"/>
                        </div>
                        <% }
                        %>
                    </div>
                    <div class="block"></div>
                </div>
            </section>
        </div>

        <!--==============================footer=================================-->
        <footer>
            <%@include file="../disenoWeb/footer.html" %>
        </footer>
        <%String error = (String) session.getAttribute("error");
            if (error != null) {
        %><script>alert("The input file is not formatted correctly. ");</script><%
                session.removeAttribute("error");

            }%>
        <script type="text/javascript"> Cufon.now();</script>
    </body>
</html>


